package D12_9z.xml练习题.xml解析_2;

import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;

import java.util.List;

public class Demo1 {
    public static void main(String[] args) throws Exception{
        SAXReader saxReader = new SAXReader();
        Document read = saxReader.read("src/Y2019/M12_/D12_9/xml练习题/xml解析_2/cars.xml");
        Element root = read.getRootElement();
        List<Element> result = root.elements("VALUE");
        for (Element e : result) {
            List<Element> no = e.elements("NO");
            for (Element el : no) {
                System.out.println("车牌号码:"+el.attributeValue("DATE"));
                System.out.println("车主地址:"+e.elementText("ADDR"));
            }
        }
    }
}
